---
title: "Impact of long-term mass-rearing on the genetic structure of tsetse fly Glossina
  palpalis gambiensis colonies"
author: "Kiswend-sida M. Dera1,2, Soumaïla Pagabeleguem2,3, Tito Tresor Melachio Tanekou4,5,Ange Irénée Toé2, Gisèle Marie Sophie Ouedraogo/Sanou2, Adrien Marie Gaston Belem6, Sophie Ravel7, Thierry De Meeus7, Robert L. Mach8, Marc J. B. Vreysen1, Adly M.M.
  Abd-Alla1*"
date: "2023-11-13"
output: word_document
---

```{r}
library(ggplot2)

### load work place ####
setwd("C:/Users/abdallaa/OneDrive - IAEA/My_passport_6/Dera_2023/population genetics MS/revised version/raw_data")
```

###Evaluation of the presence of SAD
```{r}
## loading of the data for the checking of SAD
sad <- read.csv("SAD.csv")
sad
summary(sad)
str(sad)

#checking the presence of SAD in Pgp24 loci
pgp24 <- subset(sad,Loci=="Pgp24")
pgp24
with(pgp24, cor.test(Allele, Capf, alternative="less", method="spearman"))
#checking the presence of SAD in Pgp24 loci
B3 <- subset(sad,Loci=="B3")
B3
with(B3, cor.test(Allele, Capf, alternative="less", method="spearman"))

#checking the presence of SAD in Pgp24 loci
C102 <- subset(sad,Loci=="C102")
C102
with(C102, cor.test(Allele, Capf, alternative="less", method="spearman"))

#checking the presence of SAD in Pgp24 loci
pgp15 <- subset(sad,Loci=="Pgp15")
pgp15
with(pgp15, cor.test(Allele, Capf, alternative="less", method="spearman"))

#checking the presence of SAD in Pgp24 loci
pgp16 <- subset(sad,Loci=="Pgp16")
pgp16
with(pgp16, cor.test(Allele, Capf, alternative="less", method="spearman"))

#checking the presence of SAD in Pgp24 loci
pgp27 <- subset(sad,Loci=="Pgp27")
pgp27
with(pgp27, cor.test(Allele, Capf, alternative="less", method="spearman"))
mod<-lm(formula = Smallf ~ Allele, data = pgp27, weights = Weight)
summary(mod)

#checking the presence of SAD in Pgp24 loci
X55.3 <- subset(sad,Loci=="X55.3")
X55.3
with(X55.3, cor.test(Allele, Capf, alternative="less", method="spearman"))


#checking the presence of SAD in Pgp24 loci
Xpgp13 <- subset(sad,Loci=="XPgp13")
Xpgp13
with(Xpgp13, cor.test(Allele, Capf, alternative="less", method="spearman"))

#checking the presence of SAD in Pgp24 loci
XB104 <- subset(sad,Loci=="XB104")
XB104
with(XB104, cor.test(Allele, Capf, alternative="less", method="spearman"))
mod<-lm(formula = Smallf ~ Allele, data = XB104, weights = Weight)
summary(mod)

#checking the presence of SAD in Pgp24 loci
XB110 <- subset(sad,Loci=="XB110")
XB110
with(XB110, cor.test(Allele, Capf, alternative="less", method="spearman"))
mod<-lm(formula = Smallf ~ Allele, data = XB110, weights = Weight)
summary(mod)
```

##Evaluation of the correlation between FIS and FST and FIS and number of Blank
```{r}
data_reg <- read.csv("data_reg.csv")
data_reg
summary(data_reg)
str(data_reg)

#Correlation between FIS and FST
with(data_reg, cor.test(FIS, FST, alternative="greater", method="spearman"))

#Correlation between FIS and Number of blank
with(data_reg, cor.test(FIS, Nblank, alternative="greater", method="spearman"))
```


